package edu.gatech.cs2340.teamrocket.model.storage;

import edu.gatech.cs2340.teamrocket.control.exception.InvalidTransactionException;
import edu.gatech.cs2340.teamrocket.model.item.Item;

/**
 * Interface for any class that will accept Items.
 *
 * @author Joe Tacheron
 */
public interface Consumer {

    /**
     * Add a single Item to this Consumer.
     *
     * @param i the Item to Add
     */
    void addItem(Item i);

    /**
     * Add multiple Items to this Consumer.
     *
     * @param i the Item to Add
     * @param quantity the number of this Item to Add
     */
    void addItem(Item i, int quantity);

    /**
     * Indicates this Consumer has the necessary resources to buy an Item
     *
     * @param i the Item to buy
     * @return true if this consumer can buy Item i, false otherwise
     */
    boolean canBuyItem(Item i);

    /**
     * Indicates this Consumer has the necessary resources to buy a certain amount of an Item
     *
     * @param i the Item to buy
     * @parama quantity the amount of Item i
     * @return true if this consumer can buy the quantity of Item i, false otherwise
     */
    boolean canBuyItem(Item i, int quantity);

    /**
     * Add a single Item to this Consumer and subtract the value of that Item
     * from this Consumer's money amount.
     *
     * @param i the Item to buy
     * @throws InvalidTransactionException Indicates this Consumer did not have
     * enough money to complete the transaction
     */
    void buyItem(Item i) throws InvalidTransactionException;

    /**
     * Add a multiple Items to this Consumer and subtract the value of those
     * Items from this Consumer's money amount.
     *
     * @param i the Item to buy
     * @param quantity the number of this Item to buy
     * @throws InvalidTransactionException Indicates this Consumer did not have
     * enough money to complete the transaction
     */
    void buyItem(Item i, int quantity) throws InvalidTransactionException;

    /**
     * Subtract money from this Consumer.
     *
     * @param i the Item to buy
     * @param quantity the number of this Item to buy
     */
    void deductMoney(Item i, int quantity);
}
